﻿using System;
using System.Data;
using System.Data.SqlClient;

using System.Configuration;


public class DropdownFunctions
{

    public DropdownFunctions()
    {
    }
    # region Variable Declaration

    string connectionString = ConfigurationManager.ConnectionStrings["GemsConnectionString"].ToString();

    # endregion

    # region Property

    private static string _fieldname = null;
    private static string _valueField = null;
    private static string _displayField = null;
    private static string _condition = null;


    public static string Fieldname
    {
        get
        {
            return _fieldname;
        }
        set
        {
            _fieldname = value;
        }
    }

    public static string Condition
    {
        get
        {
            return _condition;
        }
        set
        {
            _condition = value;
        }
    }

    public static string DisplayField
    {
        get
        {
            return _displayField;
        }
        set
        {
            _displayField = value;
        }
    }

    public static string ValueField
    {
        get
        {
            return _valueField;
        }
        set
        {
            _valueField = value;
        }
    }

    # endregion

    # region Common User Procedures

    public DataSet Load_Dropdown()
    {
        DataSet dsDropdown = new DataSet();

        try
        {

            //dsDropdown = SqlHelper.ExecuteDataset(connectionString, CommandType.StoredProcedure, "DMS_Dropdown_Masters", new SqlParameter("@fieldName", _fieldname), new SqlParameter("@Condition", _condition));

             //dsDropdown = SqlHelper.ExecuteDataset(connectionString, CommandType.StoredProcedure, "DMS_Dropdown_Masters", new SqlParameter("@fieldName", _fieldname), new SqlParameter("@Condition", _condition));


            _displayField = dsDropdown.Tables[0].Columns[1].ToString();
            _valueField = dsDropdown.Tables[0].Columns[0].ToString();
        }

        catch (Exception ex)
        {
            JSAlert.Show(ex.Message);
        }

        return dsDropdown;

    }

    # endregion
}


